<!--
 * @Descripttion: 系统计划任务配置
 * @version: 1.0
 * @Author: sakuya
 * @Date: 2021年7月7日09:28:32
 * @LastEditors:
 * @LastEditTime:
-->

<template>
	<el-container>
		<el-main  style="padding:0 20px;">
			<scTable ref="table" :apiObj="listApi" row-key="id" :params="listApiParams"  stripe :paginationLayout="'prev, pager, next,total'">
				<el-table-column label="创建时间" prop="createtime" width="200"></el-table-column>
				<el-table-column label="执行时间" prop="execTime" width="150"></el-table-column>
				<el-table-column label="执行结果" prop="state" width="100">
					<template #default="scope">
						<span v-if="scope.row.resultStatus" style="color: #67C23A;"><el-icon><el-icon-success-filled /></el-icon></span>
						<span v-else style="color: #F56C6C;"><el-icon><el-icon-circle-close-filled /></el-icon></span>
					</template>
				</el-table-column>
				<el-table-column label="执行日志" prop="logs" width="100" fixed="right">
					<template #default="scope">
						<el-button size="small" @click="show(scope.row)" type="text">日志</el-button>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>

	<el-drawer title="日志" v-model="logsVisible" :size="800" direction="rtl" destroy-on-close>
		<el-main  style="padding:0 20px 20px 20px;">
			<pre style="font-size: 12px;color: #999;padding:20px;background: #333;font-family: consolas;line-height: 1.5;overflow: auto;">{{demoLog}}</pre>
		</el-main>
	</el-drawer>
</template>

<script>
	export default {
		data() {
			return {
				listApi: null,
				listApiParams: {},
				logsVisible: false,
				demoLog: '',
			}
		},
		mounted() {

		},
		methods: {
			show(data){
				if(data.sysLongtext){
					this.demoLog=data.sysLongtext.bigtext;
				}else{
					this.demoLog='暂无日志';
				}
				this.logsVisible = true;
			},
			open(data){
				this.listApiParams = {
					id: data.id
				}
				this.listApi=this.$API.system.tasks.logs;
				console.log(data);
				//this.logsVisible = true;
			}
		}
	}
</script>

<style>
</style>
